// 合同新建页面样式
.contract-add {
  width: 100%;
  min-height: 100vh;
  // background: #FFFFFF !important; // 强制覆盖全局背景色
  overflow-x: hidden;
  position: relative;
  z-index: 1;
  padding-bottom: 180px; // 为底部按钮预留空间
  // box-shadow: 0px 4px 15px 0px rgba(0, 0, 0, 0.05);
}

// 确保页面完全覆盖全局背景
body {
  background: #FFFFFF !important;
}

// 顶部导航区域背景
.header-wrapper {
  width: 750px;
  background: #3F99F9;
  border-radius: 0px 0px 0px 0px;
  position: relative;
  margin: 0 auto;
}

// 顶部导航
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 44px 40px 20px 20px;
  background: transparent;
  position: relative;

  .back-icon {
    width: 60px;
    height: 60px;
    font-size: 60px;
    color: #FFFFFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .header-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 324px;
    height: 54px;
    font-family: 'Source Han Sans CN', 'Source Han Sans CN';
    font-weight: 500;
    font-size: 32px;
    color: #FFFFFF;
    text-align: center;
  }
}



// 表单容器
.form-container {
  // background: #fff;
  // padding: 20px;
  // box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    // margin-top: 30px;
  // 全局van-field样式
  .van-field {
    text-align: left !important;
    direction: ltr !important;

    .van-field__control {
      font-family: Source Han Sans CN, Source Han Sans CN;
      font-weight: 400;
      font-size: 32px;
      color: #999999;
      text-align: left;
      font-style: normal;
      text-transform: none;
    }

    // 为合同名称字段的van-field__value添加底部内边距
    .van-field__value {
      padding-bottom: 6px;
    }
  }

  .form-section-title {
    background: #f8f8f8;
    padding:0px 15px 0px 30px;
    margin: 14px 0px !important;
    font-family: Source Han Sans CN, Source Han Sans CN;
    font-weight: 400;
    font-size: 24px;
    color: #999999;
    text-align: left;
    font-style: normal;
    text-transform: none;
  }
  .form-contract-uploader{
    min-height: 80px!important;
  }
  .form-field {
    // margin-bottom: 15px; // 增加底部间距
    margin: 30px 0;
    padding: 18px 20px 0px 30px;
    min-height: 134px;
    background: #FFFFFF;
    position: relative;

    // 为合同名称字段（第一个字段）的van-field__value添加底部内边距
    &:first-child .van-field__value {
      padding-bottom: 6px;
    }
 
    // 在第一个表单字段前添加#F8F8F8背景间距
    // &:first-child::before {
    //   content: '';
    //   position: absolute;
    //   top: -45px;
    //   left: 0;
    //   right: 0;
    //   height: 60px;
    //   background: #F8F8F8;
    // }

    // 在每个表单字段后添加#F8F8F8背景间距
    // &::after {
    //   content: '';
    //   position: absolute;
    //   bottom: -24px;
    //   left: 0;
    //   right: 0;
    //   height: 30px;
    //   background: #F8F8F8;
    // }

    // 最后一个表单字段不显示底部间距
    &:last-child::after {
      display: none;
    }

    // 合同说明字段不显示底部间距，避免遮挡
    &.textarea-field::after {
      display: none;
    }

    // 我方负责人字段不显示底部间距，避免遮挡
    &.our-party-second::after {
      display: none;
    }

    // 我方信息部分连接样式
    &.our-party-first {
      margin-bottom: 0;
      margin-top: 0!important;
      border-bottom: 1px solid #F0F0F0;
      
      // 连接字段不显示底部间距
      &::after {
        display: none;
      }
    }

    &.our-party-second {
      margin-top: 0;
      margin-bottom: 0;
      border-top: none;
    }

    // 对方信息部分连接样式
    &.counterparty-first {
      margin-bottom: 0;
      margin-top: 0;
      border-bottom: 1px solid #F0F0F0;
      
      // 连接字段不显示底部间距
      &::after {
        display: none;
      }
    }

    &.counterparty-second {
      margin-top: 0;
      border-top: none;
    }

    .field-label {

      font-family: Source Han Sans CN, Source Han Sans CN;
      font-weight: 400;
      font-size: 32px;
      color: #333333;
      text-align: left;
      font-style: normal;
      text-transform: none;
    }

    .custom-field {
      // background: #f8f9fa;
      padding: 12px 0;

      font-family: Source Han Sans CN, Source Han Sans CN;
      font-weight: 400;
      font-size: 32px;
      color: #999999;
      text-align: left;
      font-style: normal;
      text-transform: none;

      .van-field__control {
        font-family: Source Han Sans CN, Source Han Sans CN;
        font-weight: 400;
        font-size: 32px;
        color: #999999;
        text-align: left;
        font-style: normal;
        text-transform: none;

        &::placeholder {
          font-family: Source Han Sans CN, Source Han Sans CN;
          font-weight: 400;
          font-size: 32px;
          color: #999999;
          text-align: left !important;
          font-style: normal;
          text-transform: none;
        }
      }
    }

    &.textarea-field {
      margin-bottom: 0!important;
      .custom-field {
        padding: 12px 0;

        .van-field__control {
          font-family: Source Han Sans CN, Source Han Sans CN;
          font-weight: 400;
          font-size: 14px;
          color: #333333;
          text-align: left !important;
          direction: ltr !important;
          font-style: normal;
          text-transform: none;
          min-height: 60px;
          resize: none;

          &::placeholder {
            font-family: Source Han Sans CN, Source Han Sans CN;
            font-weight: 400;
            font-size: 14px;
            color: #999999;
            text-align: left !important;
            direction: ltr !important;
            font-style: normal;
            text-transform: none;
          }
        }

        // 字符计数样式
        .van-field__word-limit {
          font-size: 12px;
          color: #999999;
          text-align: right;
          margin-top: 4px;
        }
      }
    }

    .select-field {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 0;
      cursor: pointer;

      .select-value {
        font-family: Source Han Sans CN, Source Han Sans CN;
        font-weight: 400;
        font-size: 32px;
        color: #999999;
        text-align: left;
        font-style: normal;
        text-transform: none;

        &.placeholder {
          font-family: Source Han Sans CN, Source Han Sans CN;
          font-weight: 400;
          font-size: 32px;
          color: #999999;
          text-align: left !important;
          font-style: normal;
          text-transform: none;
        }
      }

      .select-arrow {
        font-size: 32px;
        color: #999999;
        margin-left: 8px;
        flex-shrink: 0;
      }
    }
  }

  .character-count {
    text-align: right;
    margin-top: -8px;
    margin-bottom: 16px;

    .count-text {
      font-size: 12px;
      color: #999;
    }
  }
}

.opacity-label {
  span {
    &.placeholder {
      opacity: 0.5 !important;
    }
  }

}

// 流程步骤样式
.process-step-container {
  // padding: 16px;
  background: #fff;
  // margin-bottom: 16px;
  padding: 18px 20px 0px 30px;
  position: relative;

  // &::after {
  //   content: '';
  //   position: absolute;
  //   bottom: -10px;
  //   left: 0;
  //   right: 0;
  //   height: 10px;
  //   background: #f8f8f8;
  // }
}

.process-step-title {
  font-family: Source Han Sans CN, Source Han Sans CN;
  font-weight: bold;
  font-size: 32px;
  color: #333333;
  text-align: left;
  font-style: normal;
  text-transform: none;
  padding-top: 18px;
  padding-bottom: 18px;
}

.process-steps {
  .process-step {
    display: flex;
    align-items: flex-start;
    position: relative;
    padding-top: 24px;

    &.is-last {
      padding-bottom: 22px;
    }
  }

  .step-line-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: 16px;
    margin-top: 2px; // 向下调整2px与标题对齐

    .step-dot {
      width: 15px;
      height: 15px;
      background: rgba(0,0,0,0.2);
      border: 1px solid rgba(0,0,0,0.1);
      border-radius: 50%;
    }

    .step-line {
      width: 2px;
      height: 100px;
      background: rgba(0, 0, 0, 0.1);
      margin-top: 8px;
      
    }
  }

  .step-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    .step-title-container {
      margin-top: -4px; // 向上调整4px与步骤线对齐
      font-family: Source Han Sans CN, Source Han Sans CN;
      font-weight: 400;
      font-size: 26px;
      color: #999999;
      text-align: left;
      font-style: normal;
      text-transform: none;
      gap: 2px;
    }

    .step-title {
      font-family: Source Han Sans CN, Source Han Sans CN;
      font-weight: 400;
      font-size: 32px;
      color: #333333;
      text-align: left;
      font-style: normal;
      text-transform: none;
    }

    .step-subtitle {
      font-family: Source Han Sans CN, Source Han Sans CN;
      font-weight: 400;
      font-size: 26px;
      color: #999999;
      text-align: left;
      font-style: normal;
      text-transform: none;
      margin-top: 5px;
    }

    .step-person {
      display: flex;
      flex-direction: column;
      align-items: center;

      .person-avatar {
        width: 68px;
        height: 68px;
        border-radius: 5px 5px 5px 5px;
        margin-bottom: 4px;
        margin-top: -12px;

        img {
          width: 100%;
          height: 100%;
          object-fit: cover;
          border-radius: 5px 5px 5px 5px;
        }

        .avatar-text {
          width: 100%;
          height: 100%;
          background-color: #3F99F9;
          color: white;
          display: flex;
          align-items: center;
          justify-content: center;
          border-radius: 5px 5px 5px 5px;
          font-size: 28px;
          font-weight: 500;
        }
      }

      .person-name {
padding-top: 4px;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 22px;
color: #999999;
text-align: center;
font-style: normal;
text-transform: none;
        text-align: center;
      }
    }
  }
}

// 底部操作按钮
.action-buttons {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #FFFFFF;
  padding: 20px 30px 40px;
  display: flex;
  justify-content: center;
  box-shadow: 0px -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100;

  .action-btn {
    border-radius: 8px;
    font-weight: 400;
    font-size: 36px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 88px;

    &:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    // 提交按钮
    &.submit-btn {
      font-family: Source Han Sans CN, Source Han Sans CN;
      font-weight: 400;
      font-size: 36px;
      color: #FFFFFF;
      text-align: center;
      font-style: normal;
      text-transform: none;
      background-color: #2D67B0;
      border: none !important;
      width: 584px;
      height: 84px;
      border-radius: 10px;

      &:not(:disabled):active {
        background: #245A9B;
      }
    }
  }
}

// ActionSheet 样式覆盖
:deep(.van-action-sheet) {
  .van-action-sheet__header {
    font-size: 32px;
    font-weight: 600;
    color: #333333;
    padding: 20px 0;
    // border-bottom: 2px solid #F5F5F5;
  }

  .van-action-sheet__item {
    font-size: 28px;
    color: #333333;
    padding: 24px 0;
    transition: background-color 0.2s ease;

    &:active {
      background-color: #F5F5F5;
    }
    
    // 确保active状态正确恢复
    &:not(:active) {
      background-color: transparent;
    }

    &:not(:last-child) {
      // border-bottom: 1px solid #F0F0F0;
    }
  }

  .van-action-sheet__cancel {
    font-size: 28px;
    color: #666666;
    padding: 24px 0;
    margin-top: 16px;
    background: #FFFFFF;
    border-radius: 16px 16px 0 0;
  }
}

// DatePicker 样式覆盖
:deep(.van-date-picker) {
  .van-picker__toolbar {
    padding: 20px 30px;
    border-bottom: 2px solid #F5F5F5;

    .van-picker__title {
      font-size: 32px;
      font-weight: 600;
      color: #333333;
    }

    .van-picker__cancel,
    .van-picker__confirm {
      font-size: 28px;
      color: #3F99F9;
      font-weight: 500;
    }
  }

  .van-picker-column__item {
    font-size: 28px;
    color: #333333;
    padding: 16px 0;

    &--selected {
      color: #3F99F9;
      font-weight: 600;
    }
  }
}

// 表单验证错误状态
:deep(.van-field--error) {
  .van-cell {
    .van-cell__title {
      color: #FF4D4F;
    }

    .van-field__control {
      color: #FF4D4F;
    }
  }
}

// 自定义字段样式
.custom-field {
  :deep(.van-field__control) {
    font-family: Source Han Sans CN, Source Han Sans CN;
    font-weight: 400;
    font-size: 32px;
    color: #999999;
    text-align: left;
    font-style: normal;
    text-transform: none;
    // text-align: right;
  }

  :deep(.van-field__right-icon) {
    color: #c8c9cc;
    font-size: 24px;
  }
}

// 日期选择器样式修复
:deep(.van-popup) {
  z-index: 9999;
}

:deep(.van-date-picker) {
  background: #fff;
  border-radius: 16px 16px 0 0;
}

  .van-action-sheet__header {
    padding: 20px 32px;

    .van-action-sheet__title {
      font-size: 32px;
      color: #333;
      font-weight: 500;
    }
  }

  .van-action-sheet__item {
    padding: 24px 32px;
    font-size: 30px;
    color: #333;

    transition: background-color 0.15s ease;
    
    &:active {
      background-color: #f7f8fa;
    }
    
    // 确保active状态正确恢复
    &:not(:active) {
      background-color: transparent;
    }
  }

/* 移除自定义的图片预览样式，使用 Vant4 默认预览（与 Uploader 保持一致） */